package ui.map 
{
	import com.greensock.plugins.ShortRotationPlugin;
	import com.greensock.plugins.TransformAroundPointPlugin;
	import com.greensock.plugins.TweenPlugin;
	import flash.display.MovieClip;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author usual
	 */
	public class CustomMap extends MovieClip 
	{
		private var _mapBackground:MapBackGround;
		public function CustomMap() 
		{
			addEventListener(Event.ADDED_TO_STAGE, _build);
		}
		
		public function resize():void 
		{
			if (_mapBackground)_mapBackground.resize();
		}
		
		public function destroy():void 
		{
			_mapBackground.destroy();
			if (this.parent != null) parent.removeChild(this);
		}
		
		public function zoomMap(value:int):void 
		{
			_mapBackground.zoomMap(value);
		}
		
		private function _build(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, _build);
			addMapBackGround();
		}
		
		private function addMapBackGround():void 
		{
			TweenPlugin.activate([ShortRotationPlugin, TransformAroundPointPlugin]);
			_mapBackground = new MapBackGround();
			_mapBackground.name = "_mapBackground";
			addChild(_mapBackground);
		}
		
	}

}